package com.example.mapper;

import com.example.entity.ChinaArea;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Title: spring-boot-druid
 * @Package com.example.mapper
 * @Date 2018/5/9下午3:01
 * @Author PX ye
 * @E-mail yepx2013@gmail.com
 * @Company http://www.yiautos.com
 * @Description: ${todo}
 */
@Mapper
public interface ChinaAreaMapper {

    @Select("SELECT * FROM china_area WHERE id=#{id}")
    ChinaArea getChinaAreaById(Long id);

    @Select("SELECT * FROM china_area WHERE parent_id=#{parentId}")
    List<ChinaArea> getChinaAreaByParentId(Long parentId);

    @Select("SELECT * FROM china_area WHERE parent_id IS NULL")
    List<ChinaArea> getChinaAreaByNotParentId();
}
